package com.njbdqn.ALi.zjg.dao;

import java.util.List;

import org.njbdqn.ali.database.SqlTemplate;

import com.njbdqn.ALi.zjg.vo.RecommendNeedRecordVO;
import com.njbdqn.ALi.zjg.vo.TicketVO;

public class TicketDAO {
	private SqlTemplate template;
	public TicketDAO(){
		template = new SqlTemplate();
	}
	public int modify(int account){
		String sql="update ticket set acquireticket=acquireticket+1,beLeftticket=beLeftticket+1 where account=?";
		return template.update(sql, new Object[]{account});
	}
	
	public TicketVO findAll(int account){
		String sql="select acquireticket,beLeftticket from userinfos where account=?";
		return (TicketVO)template.resultToArray(sql, new Object[]{account}, TicketVO.class).get(0);
	}
	public List findTicket(int account){
		String sql="select recommendbookname, recommendbookvotenumber, recommendbooktime "
				+ " from  recommendneedrecord where account=?";
		return template.resultToArray(sql, new Object[]{account}, RecommendNeedRecordVO.class);
	}
}
